import org.codehaus.groovy.grails.commons.ConfigurationHolder as CH

class AutenticateFilters {
    def filters = {
		validateURL(controller:'*', action:'*') {
			before = {
					/*
					println ""
								
					if (session.user == null) {
						log.debug "controller  " + controllerName +" action  " + actionName						
						if ( controllerName == "note" && CH.config.comics.actionAllowedInitial.grep(actionName) ) {
							log.debug "Se entra a la pagina inicial"
							return true							
						}
						
						
						if ( controllerName == "user" && CH.config.comics.actionAllowedUser.grep(actionName) ) {
							log.debug "Se crea un usuario nuevo"
							return true							
						}
						
						if ( controllerName == "autenticate" && CH.config.comics.actionAllowedAutenticate.grep(actionName) ) {
							//redirect(controller:controllerName, action:actionName)
							log.debug "Procedemos a logearnos"
							return true
						}
								  
						//	NO permitimos entrar a los metodos que tienen que ir por POST
						log.debug "Session expirada"
						flash.message = "should.autenticate"
						redirect(controller:'note', action:"index")
						return false
					
					}
					*/
			}
			
		}
    }
}
